package com.zhenyi.xhc.core;

import com.cjw.model.DBMap;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.utils.AuthUtils;

public class XHCAuthInterceptor implements Interceptor {
	@Override
	public void intercept(Invocation inv) {
		if (AuthUtils.verify(inv.getController())) {
			inv.invoke();
		} else {
			DBMap map = new DBMap();
			map.put("status", 401);
			map.put("msg", "requir auth");
			inv.getController().renderJson(map);
		}
	}

}
